package com.itfenghuang.day10;

import jdk.internal.util.xml.impl.Input;

import java.io.*;

public class A04_转换流 {
    public static void main(String[] args) throws IOException {
        /**
         * 1.概述
         *  字符流= 字节流+ 编码表
         *       OutputStreamWriter
         *          构造方法:
         *          public  OutputStreamWriter(OutputStream out)
         *          成员方法
         *          public void write(int c) 一次写出一个字符
         *       InputStreamReader
         *       构造方法;
         *       public InputStreamReader(inputstream in)
         *
         */

        OutputStreamWriter osw = new OutputStreamWriter
                (new FileOutputStream("D:\\it\\a.txt"));
        osw.write(97);
        osw.write("做人鬼屎一点");
        //释放资源
        osw.close();
        //public InputStreamReader(InputStream in, String charsetName)
        //可以指定一个字符集编码
        InputStreamReader isr = new InputStreamReader
                (new FileInputStream("D:\\it\\a.txt"),"utf-8");
        int i;
        while ((i=isr.read())!=-1){
            System.out.println((char) i);
        }
        isr.close();



    }
}
